#################################################################
## Purpose: setup file for "Criminal Victimization and Agency Attitudes in Mexico"
## Author: Cassy Dorff, 2024
## Step 0: set up workspace + libraries + data paths
#################################################################

## SET UP FILE
## R Version: 2023.06.1+524 
## Set up your personal paths below

## clear workspace
rm(list=ls())

## setup working directory
if(Sys.info()['user']=='dorffc')
{pathMain="~/Desktop/replication"; 
pathGraphics = "~/Desktop/replication/graphics/"; 
pathData="~/Desktop/replication/data/"}

## packages
loadPkg=function(toLoad){
  for(lib in toLoad){
      if(! lib %in% installed.packages()[,1])
    { install.packages(lib, repos='http://cran.rstudio.com/') }
    suppressMessages( library(lib, character.only=TRUE) ) }
}

packs=c('foreign', 'MASS', 'xtable', 'ggplot2',
        'stargazer', 'dplyr', 'gridExtra', 'marginaleffects',
        'tidyverse', 'lmtest',
        'reshape2', 'pscl', 'mlogit', 'MNP',
        'knitr', 'haven')

loadPkg(packs)
